<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/templates/tmpl_no_login.xhtml">
	<ui:define name="centro">

		<h:form id="form">
			<p:panel header="Cadastro do Jogador">
				
				<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
				
				<h:panelGrid id="formulario" columns="2" cellpadding="4">
					<p:outputLabel value="E-mail" for="email" />
					<p:inputText id="email" value="#{cadastroJogadorMBean.jogador.email}" required="true" />

					<p:outputLabel value="Nome" for="nome" />
					<p:inputText id="nome" value="#{cadastroJogadorMBean.jogador.nome}" required="true" />

					<p:outputLabel value="Papel" for="nivel"/>
					<p:autoComplete value="#{cadastroJogadorMBean.jogador.papel}"
						id="nivel" completeMethod="#{cadastroJogadorMBean.completePapel}"
						converter="#{papelConverter}" var="j" itemLabel="#{j.descricao}"
						itemValue="#{j}" forceSelection="true" required="true"/>

					<p:outputLabel value="Senha:" for="senha"/>
					<p:password id="senha" value="#{cadastroJogadorMBean.jogador.senha}"
						feedback="true" promptLabel="Nível da senha" weakLabel="Fraca"
						goodLabel="Razoável" strongLabel="Forte" required="true"/>
					
					<p:outputLabel value="Foto:" />
					<p:fileUpload fileUploadListener="#{cadastroJogadorMBean.upload}" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
					
					<p:commandButton action="#{cadastroJogadorMBean.cadastrar()}"
						value="Cadastrar" />

				</h:panelGrid>

			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>

</html>
